package com.crazymaker.springcloud.demo.controller;

import com.crazymaker.springcloud.demo.api.UAAUserApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;

@RestController
@RequestMapping("/api/call/uaa/")
@Api("演示uaa-provider远程调用")
public class UaaRemoteCallController {

    @Autowired
    private UAAUserApi uuaUserApi;

    @GetMapping("/api/user/detail/v1")
    @ApiOperation(value = "Feign远程调用")
    public ResponseEntity<Object> getUser(@RequestParam(value = "userId", required = true) Long userId) {
        return uuaUserApi.getUser(BigInteger.valueOf(userId));
    }
}
